Skip to main content
Version: legacy

Inbound Message

An inbound message or MO(Mobile Originated) message is a message sent to businesses from a WhatsApp user.

The default format for inbound message is as mentioned below:

Inbound message fields

NameDescriptionJSON Type
fromMSISDN of the user sending the message.String
toThe identifier of the receiving bot.String
replying_toA context object, present only if the user is replying to a specific thread.String
idGenerated message id for the inbound message.String
timestampISO-8601 datetime of the status update.String
referralContaining details about Click to WhatsApp Ads from Meta.Object
contextUsed when user replies or interacts with one of the message.Object
typeThe type of message sent by user. Like - text, image, video, audio, document, interactive, button, location, order.Text

The following are different types of inbound messages sent by user:

  • Location
  • Quick Reply Button
  • Interactive Message
  • List Message
  • Quick Reply Message
  • Media Message
  • Image
  • Video
  • Document
  • Audio
  • Message generated from Click to WhatsApp Ads
  • Inbound Replies to Sent messages

Text message

NameDescriptionJSON Type
bodyThe text of the text message.String

Payload:

{
"contacts": [
{
"profile": {
"name": "Kerry Fisher"
},
"wa_id": "16315551234"
}
],
"messages": [
{
"from": "16315551234",
"id": "ABGGFlA5FpafAgo6tHcNmNjXmuSf",
"timestamp": "1518694235",
"text": {
"body": "Hello this is an answer"
},
"type": "text"
}
]
}

Image Message

NameDescriptionJSON Type
mime_typeSupported data type of the image.String
captionCaption value provided by the user - Optional.String
urlImage URL to download the file.String

Payload:

{
"messages": {
"image": {
"mime_type": "image/jpeg",
"caption": null,
"url": "https://sX.ap-south-X.amazonaws.com/whatsapp"
},
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXXMFkeHXH",
"to": "9XXXXXXXXXXX",
"type": "image",
"timestamp": 1598360619
}
}

Document Message

NameDescriptionJSON Type
mime_typeSupported data type.String
captionCaption value provided by the user - Optional.String
urlDocument URL to download the file.String

Payload:

{
"messages": {
"referral": null,
"document": {
"mime_type": "application/pdf",
"caption": "doc_name.pdf",
"url": "https://sX.ap-south-X.amazonaws.com/whatsapp"
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXXXAO6XVR",
"to": "9XXXXXXXXXXX",
"type": "document",
"timestamp": 1598360619
}
}

Zip File Message
Payload

{
"messages": {
"referral": null,
"document": {
"mime_type": "application/zip",
"caption": "",
"url": "https: //sX.ap-south-X.amazonaws.com/whatsapp",
"filename": "10mb.zip",
"sha256": "3b11fa6ef2bde1dd14726e09d3edaf782120"
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXXXAO6XVR",
"to": "9XXXXXXXXXXX",
"type": "document",
"timestamp": 1598360619
}
}

Media Content in 'base64' for Outbound Reply:
Payload

{
"messages": [
{
"sender": "9180XXXXXXXX",
"to": "9178XXXXXXXX",
"messageId": "fghgvd8f5XXXXfsf23",
"transactionId": "dsXXXXXfadgdfhh69665fd6",
"channel": "wa",
"type": "media",
"media": {
"contentType": "application/pdf",
"sha256Hash": "",
"caption": "hello",
"mediaUrl": "",
"content": "JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNCjw8DQovV"
}
}
],
"responseType": "json"
}


Audio Message

NameDescriptionJSON Type
mime_typeSupported data type.String
captionCaption value provided by the user - Optional.String
urlAudio URL to download the file.String

Payload:

{
"messages": {
"voice": {
"mime_type": "audio/ogg; codecs=opus",
"url": "https://sX.ap-south-X.amazonaws.com/whatsapp"
},
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAhBGtmCj_XXXXNDzynTHUCZc",
"to": "9XXXXXXXXXXX",
"type": "voice",
"timestamp": 1598360619
}
}

Video Message

NameDescriptionJSON Type
mime_typeSupported data type.String
CaptionCaption value provided by the user - Optional.String
UrlVideo URL to download the file.String

Payload:

{
"messages": {
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXXXXgo-XXXXlXMibgcy",
"video": {
"mime_type": "video/mpX",
"url": "https://sX.ap-south-X.amazonaws.com/whatsapp"
},
"to": "9XXXXXXXXXXX",
"type": "video",
"timestamp": 1598360619
}
}

Location Message

NameDescriptionJSON Type
typeFixed value location.String
latitudeLatitude of location being sent.Number
longitudeLongitude of location being sent.Number
addressAddress of the location.String
nameName of the location.String
urlURL for the website where the user downloaded the location information.Object

Payload:

{
"messages": {
"button": {
"payload": "21323",
"text": "Buy"
},
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZmZJXVFAgoXLV5XRRXOODZk",
"to": "9XXXXXXXXXXX",
"type": "button",
"timestamp": 1598360619
}
}

Quick Reply Button Message
This is the reply from a template 'quick-reply' button message. Don't confuse with the reply from an interactive button message.

NameDescriptionJSON Type
typeFixed value button.String
textThe button text.String
payloadThe payload that was sent with the button.String

Payload:

{
"messages": [
{
"button": {
"payload": "21323",
"text": "Buy"
},
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZmZJXVFAgoXLV5XRRXOODZk",
"to": "9XXXXXXXXXXX",
"type": "button",
"timestamp": 1598360619
},
{
"button": {
"payload": "21323",
"text": "Buy"
},
"referral": null,
"from": "9XXXXXXXXXXX",
"id": "ABEGkZmZJXVFAgoXLV5XRRXOODZk",
"to": "9XXXXXXXXXXX",
"type": "button",
"timestamp": 1598360619
}
]
}

Interactive Messages
Reply to non-templated list/button messages.

NameDescriptionJSON Type
typeFixed value interactive.String
list_replyUsed to notify you when customers are replying to List Messages. Contains the following information about the rows selected by the customer: id, title and description.String
Button_replyUsed to notify you when customers are replying to Quick Reply Messages. Contains the following information about the button clicked by the customer: id and title.String
ButtonTitle of the button - for both list/button message.String
buttonUniqueIDUnique button identifier.String

Button Reply
Payload

{
"messages": {
"button": "Test QR Buttons",
"referral": null,
"interactive": {
"list_reply": null,
"type": "button_reply",
"button_reply": {
"id": "id-X",
"title": "Test QR Buttons"
}
},
"buttonUniqueID": "id-X",
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXXXXgo-sKqZydjc3XfX",
"to": "9XXXXXXXXXXX",
"type": "interactive",
"timestamp": 1598360619
}
}

List Reply
Payload

{
"messages": {
"button": "row-title-content",
"referral": null,
"interactive": {
"list_reply": {
"description": "",
"id": "idX",
"title": "row-title-content"
},
"type": "list_reply",
"button_reply": null
},
"buttonUniqueID": "idX",
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "interactive",
"timestamp": 1598360619
}
}

Click to WhatsApp Ads Messages
Referral: This object is included in notifications when a user clicks on an ad, that clicks to WhatsApp and sends a message to the business. This is how the referral property works:

  • A user clicks on an ad with the Click to WhatsApp call-to-action.
  • User is redirected to WhatsApp and sends a message to the advertising business.
  • User sends a message to the business. Be aware that users may elect to remove their referral data.
  • The advertising business gets an inbound message notification including the referral property, which provides additional context on the ad that triggered the message. Knowing all this information, the business can appropriately reply to the user message.
NameDescriptionJSON Type
headlineHeadline used in the ad that generated the message.String
bodyBody from the ad that generated the message.String
source_typeThe type of the ad’s source. Currently, supported values are ad and post.String
source_idFacebook ID for an ad or a post.String
source_urlThe url that leads to the ad or post.String
image & videoThe image or video that the user saw and clicked.Object

Payload

{
"messages": [
{
"text": {
"body": "hellosinch"
},
"referral": {
"headline": "Our new product",
"body": "This is a great product",
"source_type": "<SOURCE_TYPE>",
"source_id": "<SOURCE_ID>",
"source_url": "<SOURCE_URL>",
"video": {
"id": "e144be57-12b1-4035-a520-703fcc87ef45"
}
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "text",
"timestamp": 1598360619
},
{
"text": {
"body": "hellosinch"
},
"referral": {
"headline": "Our new product",
"body": "This is a great product",
"source_type": "<SOURCE_TYPE>",
"source_id": "<SOURCE_ID>",
"source_url": "<SOURCE_URL>",
"video": {
"id": "e144be57-12b1-4035-a520-703fcc87ef45"
}
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "text",
"timestamp": 1598360619
}
]
}

Inbound Reply to Sent Messages
Users can respond to a specific message in WhatsApp. For the business to understand the context of a message reply, we include the context object. This context object provides the 'id' of the message to which the customer has replied.

Context: This object (namely replying_to) is included in the MO notification if it is in reply to a message. It contains information about the original message.

NameDescriptionJSON Type
idMessage ID of the message which is being replied directly to.String
fromMSISDN of the user which sent the message with the above message id.String
referred_productUsed for enquiries coming from a Product Detail Page, Single Product Messages and Multi-Product Message.Object

Case: Customer Replied to Your Message
Payload

{
"messages": [
{
"text": {
"body": "hellosinch"
},
"context": {
"from": "9XXXXXXXXXXX",
"id": "ABGGFlA5FpafAgo6tHcNmNjXmuSf"
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "text",
"timestamp": 1598360619
},
{
"text": {
"body": "hellosinch"
},
"context": {
"from": "9XXXXXXXXXXX",
"id": "ABGGFlA5FpafAgo6tHcNmNjXmuSf"
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "text",
"timestamp": 1598360619
}
]
}

Case: Customer asking for information about a specific product
Payload

{
"messages": {
"text": {
"body": "hellosinch"
},
"context": {
"referred_product": {
"catalog_id": "catalog-ID",
"product_retailer_id": "product-ID"
}
},
"from": "9XXXXXXXXXXX",
"id": "ABEGkZZngXdXAgo-sXXXX_gWfQdV",
"to": "9XXXXXXXXXXX",
"type": "text",
"timestamp": 1598360619
}
}

Order Message
Case: Customer placed an order after receiving a Multi or Single Product Message
Payload

{
"messages": {
"from": "9XXXXXXXXXXX",
"id": "ABEGkZmZJXVFAgoXLV5XRRXOODZk",
"to": "9XXXXXXXXXXX",
"type": "order",
"order": {
"catalog_id": "catalog_id",
"product_items": [
{
"product_retailer_id": "product-ID",
"quantity": "number-of-items",
"item_price": "unitary-price-of-item",
"currency": "price-currency"
}
],
"text": "text-message-sent-along-with-the-order"
}
}
}